#!/bin/bash

VERSION="v12.16.3"
DISTRO="linux-x64"
DOWNLOAD_URL="https://nodejs.org/dist/${VERSION}/node-${VERSION}-${DISTRO}.tar.xz"

curl -L -O "${DOWNLOAD_URL}"
sudo mkdir -p /usr/local/lib/nodejs
sudo tar -xJvf node-$VERSION-$DISTRO.tar.xz -C /usr/local/lib/nodejs

# Nodejs

cat <<EOF | tee /etc/profile.d/nodejs.sh
export PATH=/usr/local/lib/nodejs/node-$VERSION-$DISTRO/bin:$PATH
EOF

source /etc/profile

node -v
npm version
npx -v

#install yarn

npm install --global yarn